package testview.zhen.com.myapplication.hencoder.practice_draw1

import android.content.Context
import android.graphics.Canvas
import android.graphics.Paint
import android.os.Build
import androidx.annotation.RequiresApi
import android.util.AttributeSet
import android.view.View

class Practice5DrawOvalView : View {

    constructor(context: Context) : super(context) {}

    constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {}

    constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {}

    @RequiresApi(Build.VERSION_CODES.LOLLIPOP)
    override fun onDraw(canvas: Canvas) {
        super.onDraw(canvas)
        var paint = Paint()
        paint.style = Paint.Style.FILL
        canvas.drawOval(0.0f,0.0f,canvas.width.toFloat(),canvas.height.toFloat(),paint)
        //        练习内容：使用 canvas.drawOval() 方法画椭圆
    }
}
